package nuc.lizongze.backend.controller;

import nuc.lizongze.backend.service.ItemCategoryService;
import nuc.lizongze.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/backend/itemCategory")
public class ItemCategoryController {

    @Autowired
    ItemCategoryService itemCategoryService;
    /**
     * 根据父id查询子类目
     * @param id
     * @return
     */
    @RequestMapping("/selectItemCategoryByParentId")
    Result selectItemCategoryByParentId(@RequestParam(value = "id",defaultValue = "0") Long id){
        try{
            return itemCategoryService.selectItemCategoryByParentId(id);
        }catch (Exception e){
            e.printStackTrace();
        }
        return Result.build(500,"error");
    }
}
